from PIL import Image
import os

base_path="/home/vivien/Data/image/train_data"
crop_path="/home/vivien/Data/image/train_data_t"
dir=os.listdir(base_path)
for i in dir:
    file=base_path+"/"+i
    file_output=base_path+"/"+i
    img=Image.open(file).convert('RGB')
    w, h = img.size
    img.crop((0,0,w-20,h)).resize((1000,1000),Image.ANTIALIAS).save(file_output)
    print(i)